home *** CD-ROM | disk | FTP | other *** search
- head 1.8;
- branch ;
- access ;
- symbols beta10:1.7;
- locks death:1.8;
- comment @# @;
-
-
- 1.8
- date 93.04.04.23.30.47; author death; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 93.01.09.21.07.31; author death; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 93.01.01.11.51.38; author death; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 92.12.31.15.35.05; author death; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 92.12.05.23.07.31; author death; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 92.12.03.18.02.04; author death; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 92.11.27.19.38.10; author death; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 92.11.08.09.28.59; author death; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.8
- log
- @Sun Apr 4 23:30:47 PDT 1993
- @
- text
- @%BEGIN Miscellaneous
-
- %%%%%%%%%%%%%
- % Note:
- % penWidth and penHeight 'defined' in Common code.
- %%%%%%%%%%%%%
-
- %%%%%%%%%%%%%
- % Name: pnSize [0007]
- % Syntax: x y pnSize -
- % About: Set the width and height of the pen, given parameters
- %%%%%%%%%%%%%
- /pnSize
- {
- /penHeight exch def
- /penWidth exch def
- }
- def
-
- %%%%%%%%%%%%%
- % Name: pnMode [0008]
- % Syntax: mode-name pnMode -
- % About: Given the name of a drawing mode, store it in a 'global', (it
- % should be a pat* or notpat* mode). We don't check it, though.
- %%%%%%%%%%%%%
- /pnMode
- { /patternMode exch def }
- def
-
- %%%%%%%%%%%%%
- % Name: origin [000C]
- % Syntax: num num origin -
- % About: Shift the origin of the coordinate system, given an x & y delta
- %%%%%%%%%%%%%
- /origin
- { translate }
- def
-
- %%%%%%%%%%%%%
- % Name: pnLocHFrac [0015]
- % Syntax: num pnLocHFrac -
- % About: This corresponds to the 0015 opcode that allows finer placement
- % of the pen on the mac. I couldn't determine what it did
- % precisely. So, I ignore it.
- %%%%%%%%%%%%%
- /pnLocHFrac
- {pop}
- def
-
- %%%%%%%%%%%%%
- % Name: hiliteMode [001C]
- % Syntax: - hiliteMode -
- % About: 'this opcode is sent before a drawing operation that uses the hilite mode.'
- % (according to Inside Mac V p. 103). I just ignore it.
- %%%%%%%%%%%%%
- /hiliteMode
- {}
- def
-
- %END Miscellaneous
- @
-
-
- 1.7
- log
- @Sat Jan 9 21:07:31 PST 1993
- @
- text
- @@
-
-
- 1.6
- log
- @Fri Jan 1 11:51:38 PST 1993
- @
- text
- @@
-
-
- 1.5
- log
- @Thu Dec 31 15:35:04 PST 1992
- @
- text
- @@
-
-
- 1.4
- log
- @Sat Dec 5 23:07:30 PST 1992
- @
- text
- @d3 4
- a6 23
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Utility routine: QDpattern convertPattern pattern
- % Description: This takes an 8 byte binary string representing a quickdraw pattern,
- % and then converts it into a form we can use here. In Level 2, this should turn the
- % information into a pattern using this as an image. For now, we KLUDGE it by
- % gauging the approximate 'darkness' of the pattern, and then using a corresponding
- % grey value
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /GetPatGrey
- {
- /QDpattern exch def
- /darkness 0 def
-
- % get the percent darkness of each row, and add these together
- 0 1 7
- {
- QDpattern exch get % get the control variable-th byte from the pattern
- 255 div darkness add
- /darkness exch def
- }
- for
- 0 darkness 8 div sub 1 add % push the average darkness of all 8 rows
- } def
- d8 2
- a9 34
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0000
- % Name: NOP
- % Syntax: n/a
- % Description:
- % this one never gets written out to PS. No reason to.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0002
- % Name: BkPat
- % Syntax: <8-byte binary string> 0 BkPat -
- % Description:
- % This stores the background pattern as being the patten data that
- % this was passed. See usePattern for howthis is actually used.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /bkPat
- {
- /qdpattype exch def
- /qdpatdata exch def
- backPattern begin
- /QDPatType qdpattype def
- /QDPatData qdpatdata def
- /QDPatGrey qdpatdata GetPatGrey def
- end
- } def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0007
- % Name: PnSize
- d11 2
- a12 6
- % Description:
- % This takes two numbers, and sets the width and the height of
- % the drawing pen to these values. (the drawing pen variables
- % are stored in the Common portion of this code.
- % Bugs:
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d17 2
- a18 1
- } def
- d20 6
- a25 14
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0008
- % Name: PnMode
- % Syntax: name pnMode -
- % Description:
- % This takes the name of a graphics mode, and theoretically would
- % act properly on it, by changing the mode used when painting and all.
- % (the mode would be a pat* ore notpat* mode).
- % Note: The mode /badMode is passed to us if something went wrong.
- % Bugs:
- % This does nothing, except ignore it's argument.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d27 1
- a27 1
- { pop }
- d30 5
- a34 50
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0009
- % Name: PnPat
- % Syntax: <8-byte binary string> 0 pnPat -
- % Description:
- % This stores the pen pattern as being the patten data that
- % this was passed. See usePattern for how this ends up being used.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /pnPat
- {
- /qdpattype exch def
- /qdpatdata exch def
- penPattern begin
- /QDPatType qdpattype def
- /QDPatData qdpatdata def
- /QDPatGrey qdpatdata GetPatGrey def
- end
- } def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 000A
- % Name: FillPat
- % Syntax: <8-byte binary string> 0 fillPat -
- % Description:
- % This stores the fill pattern as being the patten data that
- % this was passed. See usePattern for how this ends up being used.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /fillPat
- {
- /qdpattype exch def
- /qdpatdata exch def
- fillPattern begin
- /QDPatType qdpattype def
- /QDPatData qdpatdata def
- /QDPatGrey qdpatdata GetPatGrey def
- end
- } def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 000C
- % Name: Origin
- % Syntax:
- % num num origin -
- % Description:
- % This shifts the current origin of the coordinate system, given the
- % delta x and delta y we were passed.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d39 2
- a40 123
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 000E
- % Name: fgColor
- % Syntax:
- % [red green blue] fgColor -
- % num fgColor -
- % Description:
- % This is passed an array of three numbers representing an RGB color
- % value which was converted from an old-style mac color. It then just stores
- % this in a 'global' for later use. There is a small chance that the value
- % passed may be a number instead of an array. This is for when an unexpected
- % color value was found. That value is written out directly, so that some
- % enterprising soul can fix the ps code to get the thing to work rather than
- % have to find a compiler to fix the probram.
- % Note: 'foreground' refers to the pixels turned 'on' (e.g. black) when drawing a
- % shape, and background refers to those not turned on (e.g. white).
- % Bugs:
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /fgColor
- {
- /colorValue exch def
- %
- % Check the data type of the value we were passed
- %
- colorValue type /arraytype eq
- { /foregroundColor colorValue def}
- { pop /foregroundColor [0 0 0] def }
- ifelse
- } def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 000F
- % Name: bkColor
- % Syntax:
- % [red green blue] bkColor -
- % num bkColor -
- % Description:
- % Just like forground color, but applies to background colors
- % Bugs:
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /bkColor
- {
- /colorValue exch def
- %
- % Check the data type of the value we were passed
- %
- colorValue type /arraytype eq
- { /backgroundColor colorValue def}
- {pop /backgroundColor [0 0 0] def }
- ifelse
- } def
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0011
- % Name: version
- % Syntax: n/a
- % Description:
- % This opcode should actually never be written out
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0012
- % Name: BkPixPat
- % Syntax: pattern-data [r g b] 2 BkPixPat -
- % Description:
- % This takes the specified data, and stores it in the background pattern
- % dictionary for future use.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /bkPixPat
- {
- backPattern begin
- /QDPatType exch def
- /QDColorValue exch def
- end
- pop % the 8 byte pattern data. We really dont care about it since the color will suffice
- }
- def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0013
- % Name: PnPixPat
- % Syntax: pattern-data [r g b] 2 PnPixPat -
- % Description:
- % This takes the specified data, and stores it in the background pattern
- % dictionary for future use.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /pnPixPat
- {
- penPattern begin
- /QDPatType exch def
- /QDColorValue exch def
- end
- pop % the 8 byte pattern data. We really dont care about it since the color will suffice
- }
- def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0014
- % Name: fillPixPat
- % Syntax: pattern-data [r g b] 2 fillPixPat -
- % Description:
- % This takes the specified data, and stores it in the background pattern
- % dictionary for future use.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /fillPixPat
- {
- fillPattern begin
- /QDPatType exch def
- /QDColorValue exch def
- end
- pop % the 8 byte pattern data. We really dont care about it since the color will suffice
- }
- def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0015
- % Name: pnLocHFrac
- d42 4
- a45 7
- % Description:
- % This corresponds to one of the PICT 2 opcodes. This appears to allow for
- % the finer positioning of the pen on the Mac.
- % Bugs:
- % This does nothing. I could not determine exactly the meaning
- % of its argument, or precisely what the whole does.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d50 2
- a51 36
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 001A
- % Name: RGBFgColor
- % Syntax: [red green blue] RGBFgColor -
- % Description:
- % This takes an array of three values to make up an rgb color value.
- % This color value is then stored as the foreground color (it affects
- % those portions that would be painted 'black' in a drawing operation).
- % The text and pattern code will actually put this to use.
- % Bugs:
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /RGBFgCol
- { /foregroundColor exch def }
- def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 001B
- % Name: RGBBkCol
- % Syntax: [red green blue] RGBBkCol -
- % Description:
- % This takes an array of three values to make up an rgb color value.
- % This color value is then stored as the background color (it affects
- % those portions that would be painted 'white' in a drawing operation).
- % The text and pattern code will actually put the value to use.
- % Bugs:
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /RGBBkCol
- { /backgroundColor exch def }
- def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 001C
- % Name: hiliteMode
- d53 3
- a55 6
- % Description:
- % This corresponds to one of the PICT 2 opcodes. 'this opcode is sent before
- % a drawing operation that uses the hilite mode.' (according to Inside Mac V p. 103)
- % Bugs:
- % Clearly, I'm ignoring it.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- a58 64
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 001D
- % Name: hiliteColor
- % Syntax: [red green blue] hiliteColor -
- % Description:
- % There is a drawing mode available in PICT 2 images that appears to
- % allow a shape or shapes to be drawn with a highlight color, when
- % selected say. I'm not clear exactly what it does, and it doesn't sound like
- % it's going to be relevant to this. Nevertheless, the color is written out
- % in case it turns out it should be implemented later.
- % Bugs:
- % I'm ignoring it for now.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /hiliteColor
- { pop }
- def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 001E
- % Name: defHilite
- % Syntax: - defHilite -
- % Description:
- % According to Inside Mac V, p. 103, this sounds like it replaces the
- % color set up with 1D, above, with a default value from low memory.
- % Bugs:
- % As I'm ignoring 1D, I'm ignoring this for now.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /defHilite
- {}
- def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 001F
- % Name: OpColor
- % Syntax: [red green blue] OpColor -
- % Description:
- % This appears to set a color value for some of the PICT2
- % drawing modes (blend, addpin, and subpin).
- % Bugs:
- % Since this doesn't implement any of the drawing modes, we ignore this too.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /OpColor
- { pop }
- def
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 00C0
- % Name: headerOp
- % Syntax: num num num num num num headerOp -
- % Description:
- % Another of those fine opcodes that isn't very well defined.
- % It's a pict2 opcode. It takes -1, followed by 4 32bit numbers, follwoed by -1 (I think)
- % At the moment is appears to do nothing crucial. So, we ignore it.
- % Bugs:
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /headerOp
- {pop pop pop pop pop pop}
- def
-
- @
-
-
- 1.3
- log
- @Thu Dec 3 18:02:03 PST 1992
- @
- text
- @d11 1
- a11 1
- /convertPattern
- d24 1
- a24 1
- darkness 8 div % push the average darkness of all 8 rows
- d39 6
- a44 3
- % Opcode 2: BkPat
- % macPattern bkPat -
- % Sets the background pattern to be used
- d48 7
- a54 2
- convertPattern
- /backPattern exch def
- d94 6
- a99 3
- % Opcode 9: PnPat
- % macPattern pnPat -
- % Sets the pen pattern to be used
- d103 7
- a109 2
- convertPattern
- /penPattern exch def
- d114 6
- a119 3
- % Opcode A: FillPat
- % macPattern fillPat -
- % Sets the fill pattern to be used
- d123 7
- a129 2
- convertPattern
- /fillPattern exch def
- d210 6
- a215 3
- % Opcode 0012: BkPixPat *limited*
- % pattern red green blue bkPixPat
- % This corresponds to one of the PICT 2 opcodes.
- d218 7
- a224 1
- {skipPict2Pattern}
- d227 1
- d229 6
- a234 3
- % Opcode 0013: PnPixPat *limited*
- % pattern red green blue bkPixPat
- % This corresponds to one of the PICT 2 opcodes.
- d236 8
- a243 2
- /penPixPat
- {skipPict2Pattern}
- d246 1
- d248 6
- a253 3
- % Opcode 0014: fillPixPat *limited*
- % pattern red green blue bkPixPat
- % This corresponds to one of the PICT 2 opcodes.
- d256 7
- a262 1
- {skipPict2Pattern}
- @
-
-
- 1.2
- log
- @Fri Nov 27 19:38:09 PST 1992
- @
- text
- @@
-
-
- 1.1
- log
- @Sun Nov 8 09:28:59 PST 1992
- @
- text
- @d1 1
- a1 10
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Utility routine: convertMacColor
- % macColor convertMacColor psColor
- % This takes a value (an old-style Mac color) and converts it to a PS equivalent.
- % for now it does naught. Note that this mac color could be a number,
- % or a pre-defined name...
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /convertMacColor
- {}
- def
- a2 1
-
- a27 4
- /skipPict2Pattern
- {
- %%!!!!!!! @@@@@@@@@@@@@@
- } def
- a28 1
-
- d30 5
- a34 2
- % Opcode 0: NOP
- % this one never gets written out to PS. No reason to.
- d110 7
- a116 3
- % Opcode C: Origin
- % x y origin -
- % This shifts the current origin of the coordinate system. We get a deltax and delta y.
- d119 2
- a120 3
- {
- translate % the deltas are already on the stack
- } def
- d124 16
- a139 4
- % Opcode E: fgColor
- % macColor fgColor -
- % This reads in the specifid macColor (either as a number or as one of the
- % predefined names) and sets it to being the foreground color.
- d143 8
- a150 2
- convertMacColor
- /fgColor exch def
- d155 8
- a162 4
- % Opcode F: bkColor
- % macColor bkColor -
- % This gets the specified macColor converted to a PS color, and makes it the
- % background color.
- d164 1
- a164 1
- /fgColor
- d166 8
- a173 2
- convertMacColor
- /bkColor exch def
- a175 1
-
- d177 5
- a181 2
- % Opcode 11: version
- % this opcode should actually never be written out
- a184 1
-
- a228 1
-
- d230 9
- a238 6
- % Opcode 001A: RGBFgColor
- % red green blue RGBFgColor -
- % This corresponds to one of the PICT 2 opcodes. Theoretically, it takes
- % RGB components, and sets the foreground color (again, presumably, used by
- % the fill opcodes. However, I have no idea how it interacts with patterns etc)
- % I'm just ignoring it, save for poping its arguments.
- d241 1
- a241 1
- {pop pop pop}
- d246 9
- a254 6
- % Opcode 001B: RGBBkCol
- % red green blue RGBBkColor -
- % This corresponds to one of the PICT 2 opcodes. Theoretically, it takes
- % RGB components, and sets the background color (presumably, used by
- % the erase opcodes. However, I have no idea how it interacts with patterns etc)
- % I'm just ignoring it, save for poping its arguments.
- d257 1
- a257 1
- {pop pop pop}
- d260 1
- d262 8
- a269 5
- % Opcode 001C: hiliteMode
- % - hiliteMode -
- % This corresponds to one of the PICT 2 opcodes. 'this opcode is sent before
- % a drawing operation that uses the hilite mode.' (according to Inside Mac V p. 103)
- % Clearly I'm just ignoring it.
- d275 1
- d277 11
- a287 6
- % Opcode 001D: HiliteColor
- % red green blue hiliteColor -
- % This corresponds to one of the PICT 2 opcodes. Theoretically, it takes
- % RGB components, and sets the hilite color used in hilite mode... But I really
- % can't tell you what that entails.
- % I'm just ignoring it, save for poping its arguments.
- d290 1
- a290 1
- {pop pop pop}
- d295 8
- a302 5
- % Opcode 001E: defHilite
- % - defHilite -
- % This corresponds to one of the PICT 2 opcodes. 'set hilite to default
- % (from low memory).' (according to Inside Mac V p. 103)
- % Clearly I'm just ignoring it.
- d310 8
- a317 5
- % Opcode 001F: OpColor
- % red green blue hiliteColor -
- % This corresponds to one of the PICT 2 opcodes. 'RGB OpColor for
- % arithmetic modes' (inside mac V p. 103.
- % Not applicable at present, so just pop the arguments.
- d319 2
- a320 2
- /hiliteColor
- {pop pop pop}
- a323 1
-
- d325 8
- a332 6
- % Opcode c0: header op
- % num num num num num num headerOp -
- % Another of those fine opcodes that isn't very well defined.
- % in Pict2 (doesn't exist in Pict1), this takes -1, followed by four 32 bit numbers
- % followed by -1. I think. At the moment is appears to do nothing crucial.
- % So, we ignore it.
- d338 2
- @
-